package moduleFrame
{
	import moduleFrame.interfaces.IListener;

	/**
	 * 监听角色，能听也能发消息，多用于view和controller继承
	 * @author Pelephone
	 */
	public class ListenActor extends ActorBase implements IListener
	{
		public function ListenActor(aliasName:String=null)
		{
			super(aliasName);
		}
		
		/**
		 * 监听全局消息
		 */
		public function addRootListener(type:String, listener:Function, useCapture:Boolean = false, 
										priority:int = 0, useWeakReference:Boolean = false):void
		{
			getMapRoot().addEventListener(type,listener,useCapture,priority,useWeakReference);
		}
		
		/**
		 * 移除全局消息的监听
		 * @param type
		 * @param listener
		 * @param useCapture
		 */
		public function removeRootListener(type:String, listener:Function, useCapture:Boolean = false):void
		{
			getMapRoot().removeEventListener(type,listener,useCapture);
		}
		
		/**
		 * 监听模块消息（只当前自己模块内消息有效）
		 */
		public function addModuleListener(type:String, listener:Function, useCapture:Boolean = false,
										  priority:int = 0, useWeakReference:Boolean = false):void
		{
			getMapParent().addEventListener(type,listener,useCapture,priority,useWeakReference);
		}
		
		/**
		 * 移除模块消息的监听
		 * @param type
		 * @param listener
		 * @param useCapture
		 */
		public function removeModuleListener(type:String, listener:Function, useCapture:Boolean = false):void
		{
			getMapParent().removeEventListener(type,listener,useCapture);
		}
	}
}